<template>
    <Tag @click.native='ruond' color="green">
        <slot>{{'label'}}</slot>
        <Icon v-show='val == "desc"' type="ios-arrow-up" />
        <Icon v-show='val == "asc"' type="ios-arrow-down" />
    </Tag>
</template>
<script>
export default {
    name:'sortTag',
    props:{
        value:{
            desc:'要排序的字段',
            type:String,
            default:()=>{return 'id';},
        },
    },
    data(){
        return {
            val:'null',
            nextMap:{
                "null":"asc",
                "asc":"desc",
                "desc":"null",
            }
        }
    },
    methods:{
        ruond(){
            this.$emit("on-change",this.value,(this.val = this.nextMap[this.val]));
        }
    }
}
</script>

